package com.hzncc.flowable_diboot.dto;

import com.diboot.core.binding.query.BindQuery;
import com.diboot.core.binding.query.Comparison;
import com.hzncc.flowable_diboot.entity.BusinessFollow;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.time.LocalDate;
import java.time.LocalDateTime;
/**
* 商机跟进 DTO定义
*
* @author MyName
* @version 1.0
* @date 2024-06-25
 * Copyright © MyCorp
*/
@Getter
@Setter
@Accessors(chain = true)
public class BusinessFollowDTO extends BusinessFollow  {
private static final long serialVersionUID = 1691048895807523174L;

        /**
        * 跟进时间
        */
        @BindQuery(comparison = Comparison.GE)
        private LocalDateTime followTime;
        /**
        * 跟进时间 起始
        */
        @BindQuery(comparison = Comparison.GE, column = "follow_time")
        private LocalDate followTimeBegin;

        /**
        * 跟进时间 截止
        */
        @BindQuery(comparison = Comparison.LT, column = "follow_time")
        private LocalDate followTimeEnd;
        /**
        * 下次联系时间
        */
        @BindQuery(comparison = Comparison.GE)
        private LocalDateTime nextConnectTime;
        /**
        * 下次联系时间 起始
        */
        @BindQuery(comparison = Comparison.GE, column = "next_connect_time")
        private LocalDate nextConnectTimeBegin;

        /**
        * 下次联系时间 截止
        */
        @BindQuery(comparison = Comparison.LT, column = "next_connect_time")
        private LocalDate nextConnectTimeEnd;
        /**
        * 签到时间
        */
        @BindQuery(comparison = Comparison.GE)
        private LocalDateTime checkInTime;
        /**
        * 签到时间 起始
        */
        @BindQuery(comparison = Comparison.GE, column = "check_in_time")
        private LocalDate checkInTimeBegin;

        /**
        * 签到时间 截止
        */
        @BindQuery(comparison = Comparison.LT, column = "check_in_time")
        private LocalDate checkInTimeEnd;
        /**
        * 创建时间
        */
        @BindQuery(comparison = Comparison.GE)
        private LocalDateTime createTime;
        /**
        * 创建时间 起始
        */
        @BindQuery(comparison = Comparison.GE, column = "create_time")
        private LocalDate createTimeBegin;

        /**
        * 创建时间 截止
        */
        @BindQuery(comparison = Comparison.LT, column = "create_time")
        private LocalDate createTimeEnd;
        /**
        * 更新时间
        */
        @BindQuery(comparison = Comparison.GE)
        private LocalDateTime updateTime;
        /**
        * 更新时间 起始
        */
        @BindQuery(comparison = Comparison.GE, column = "update_time")
        private LocalDate updateTimeBegin;

        /**
        * 更新时间 截止
        */
        @BindQuery(comparison = Comparison.LT, column = "update_time")
        private LocalDate updateTimeEnd;

        public LocalDate getFollowTimeEnd() {
            if (getFollowTime() != null) {
                return getFollowTime().plusDays(1).toLocalDate();
            }
            if (followTimeEnd != null) {
                return followTimeEnd.plusDays(1);
            }
            return null;
        }
        public LocalDate getNextConnectTimeEnd() {
            if (getNextConnectTime() != null) {
                return getNextConnectTime().plusDays(1).toLocalDate();
            }
            if (nextConnectTimeEnd != null) {
                return nextConnectTimeEnd.plusDays(1);
            }
            return null;
        }
        public LocalDate getCheckInTimeEnd() {
            if (getCheckInTime() != null) {
                return getCheckInTime().plusDays(1).toLocalDate();
            }
            if (checkInTimeEnd != null) {
                return checkInTimeEnd.plusDays(1);
            }
            return null;
        }
        public LocalDate getCreateTimeEnd() {
            if (getCreateTime() != null) {
                return getCreateTime().plusDays(1).toLocalDate();
            }
            if (createTimeEnd != null) {
                return createTimeEnd.plusDays(1);
            }
            return null;
        }
        public LocalDate getUpdateTimeEnd() {
            if (getUpdateTime() != null) {
                return getUpdateTime().plusDays(1).toLocalDate();
            }
            if (updateTimeEnd != null) {
                return updateTimeEnd.plusDays(1);
            }
            return null;
        }

}